{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "train samples (584, 34)\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\79021\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_split.py:2179: FutureWarning: From version 0.21, test_size will always complement train_size unless both are specified.\n",
      "  FutureWarning)\n",
      "C:\\Users\\79021\\Anaconda3\\lib\\site-packages\\pandas\\core\\frame.py:3697: SettingWithCopyWarning: \n",
      "A value is trying to be set on a copy of a slice from a DataFrame\n",
      "\n",
      "See the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n",
      "  errors=errors)\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "#模型\n",
    "from sklearn.linear_model import LinearRegression,RidgeCV,LassoCV,ElasticNetCV\n",
    "#模型评估\n",
    "from sklearn.metrics import mean_squared_error\n",
    "from sklearn.metrics import r2_score #评价回归预测模型的性能\n",
    "#可视化\n",
    "import matplotlib.pyplot as plt\n",
    "data = pd.read_csv(\"D://D/day.csv\")\n",
    "\n",
    "y = data['cnt']\n",
    "X = data.drop(['cnt','dteday','casual','registered'],axis=1)\n",
    "\n",
    "#热转换离散特征\n",
    "categorical_features = ['season','mnth','weathersit','weekday']\n",
    "for col in categorical_features:\n",
    "    data[col] = data[col].astype('object')\n",
    "X = data[categorical_features]\n",
    "X_dummies = pd.get_dummies(X)\n",
    "\n",
    "#去掉转换的离散特征，以便结合成新的数据\n",
    "X_drop = data.drop(['season','mnth','weathersit','weekday','cnt','dteday','casual','registered'],axis=1)\n",
    "X = X_dummies.join(X_drop)#合并\n",
    "\n",
    "#用train_test_split 分割训练数据和测试数据\n",
    "from sklearn.model_selection import train_test_split\n",
    "X_train,X_test,y_train,y_test = train_test_split(X,y,train_size=0.8,random_state=0)\n",
    "print(\"train samples\",X_train.shape)\n",
    "\n",
    "#保存测试ID，用于结果提交\n",
    "testID = X_test['instant']\n",
    "\n",
    "#去掉ID，ID不参与预测.\n",
    "X_train.drop(['instant'],axis=1,inplace=True)\n",
    "X_test.drop(['instant'],axis=1,inplace=True)\n",
    "\n",
    "#保存特征名字以备后用（可视化）\n",
    "feat_names = X_train.columns;\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "RMSE on training set:  752.9527366509382\n",
      "RMSE on Test set:  785.6529673042759\n"
     ]
    }
   ],
   "source": [
    "\n",
    "# 生成学习器线性回归\n",
    "lr = LinearRegression()\n",
    "lr.fit(X_train,y_train)\n",
    "\n",
    "#用训练好的学习器对训练集/测试集进行预测\n",
    "y_train_pred = lr.predict(X_train)\n",
    "y_test_pred = lr.predict(X_test)\n",
    "\n",
    "rmse_train = np.sqrt(mean_squared_error(y_train,y_train_pred))\n",
    "rmse_test = np.sqrt(mean_squared_error(y_test,y_test_pred))\n",
    "\n",
    "print(\"RMSE on training set: \" ,rmse_train)\n",
    "print(\"RMSE on Test set: \" ,rmse_test)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "r2_score on Training set:  0.797308240721808\n",
      "r2_score on test set 0.8045560823654133\n"
     ]
    }
   ],
   "source": [
    "\n",
    "#评价得分，测试集和训练集都要评价\n",
    "r2_score_train = r2_score(y_train,y_train_pred)#R2拟合程度，决定系数\n",
    "r2_score_test = r2_score(y_test,y_test_pred)\n",
    "print(\"r2_score on Training set: \",r2_score_train)\n",
    "print(\"r2_score on test set\",r2_score_test)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "OLS picked33features and eliminated the other 0 features\n"
     ]
    },
    {
     "data": {
      "image/png": "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pzZExBbNtJN0JulcSr/rqSZJq5FuCzJZEqRhqvslrRMRfyuqrjr+D7iWLnROvdUkaQ9gO2Dz6OKFgC38rIo0HVim6vXSwHMF1TIgSJqb1DFdGBGXF11PtYh4RdKtpPN1peqcPKzXYZKWqHq5IwX/wiNiSkR8NCJGRsRI0pfLp7vRMfVG0gpVL3cAHi2qlgpJWwOHATtExBtF11NC9wArSPq4pHmAL5Pug2Z1KP1F+CvgkYg4seh6ACQNr8xClTQ/sAUl+LdXywkRHSbpfNIMmACeBr4eETMKLaqKpKeB0RFReHy/pMuATwLvk24/sl9E/LXxWv1e01RgXuDlvGhCROxXYEkASNoROAUYDrwCTIqIrQqqZVvgZNINPM+OiGOLqKOapIuAMaRbQDwPHBURvyq0KEDSRsB4YArp/3OA7xY5i1fS6sC5pN/fHMBvI+LoourpiTsnMzMrHQ/rmZlZ6bhzMjOz0nHnZGZmpePOyczMSsedk5mZfaCVEF1Jm0i6X9K7knaqeW9EDnR+RNKfc0JG09w5mZlZtV/TfIjus8BY0kX0tc4jhTuvTMpkfKGVItw5mZnZB+qF6EpaTtINku6TNF7SSrnt0xHxILOu4aq0/xQwV0TclNu93upF7e6czMysN2cA/xkRawEHA6f10n5F4BVJl0t6IN8nbc5WduhsPTMz61EOrd0AuCTnc0JKUWlkLmBjUgr7s8DFpOG/plM73DmZmVkjcwCv5JuCNms68EBEPAkg6UrSzRab7pw8rGdmZj3Kt/h4StLOkMJsJa3Ry2r3AItKGp5fbwb8uZX9OlvPzMw+UC9EF7iFdK+6JUh3zv1NRBwtaW3gCmBR4C3gbxGxSt7OZ0n3sxNwH7Bvvntyc3W4czIzs7LxsJ6ZmZWOOyczMysdd05mZlY67pzMzKx03DmZmVnpuHMyM7PScedkZmal8/8BoG7n8Y4QtdgAAAAASUVORK5CYII=\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#coef_,不同参数的系数，多少个系数。\n",
    "lr.coef_.shape\n",
    "\n",
    "#plot important coefficients\n",
    "coefs = pd.Series(lr.coef_,index = feat_names)\n",
    "\n",
    "print(\"OLS picked\" + str(sum(coefs != 0)) + \"features and eliminated the other \" + \\\n",
    "      str(sum(coefs == 0))+\" features\")\n",
    "\n",
    "#正则数值最大的10个特征和负系数值最小（）的10个特征。sort_values先排序。\n",
    "imp_coefs = pd.concat([coefs.sort_values().head(10),coefs.sort_values().tail(10)])\n",
    "imp_coefs.plot(kind = \"barh\")\n",
    "plt.title(\"Coefficients in the OLS Model\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 56,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "season_1       -8.160567e+12\n",
       "season_2       -8.160567e+12\n",
       "season_3       -8.160567e+12\n",
       "season_4       -8.160567e+12\n",
       "mnth_1          3.385919e+16\n",
       "mnth_2          3.385919e+16\n",
       "mnth_3          3.385919e+16\n",
       "mnth_4          3.385919e+16\n",
       "mnth_5          3.385919e+16\n",
       "mnth_6          3.385919e+16\n",
       "mnth_7          3.385919e+16\n",
       "mnth_8          3.385919e+16\n",
       "mnth_9          3.385919e+16\n",
       "mnth_10         3.385919e+16\n",
       "mnth_11         3.385919e+16\n",
       "mnth_12         3.385919e+16\n",
       "weathersit_1   -7.336650e+14\n",
       "weathersit_2   -7.336650e+14\n",
       "weathersit_3   -7.336650e+14\n",
       "weekday_0      -3.921578e+16\n",
       "weekday_1       7.918410e+15\n",
       "weekday_2       7.918410e+15\n",
       "weekday_3       7.918410e+15\n",
       "weekday_4       7.918410e+15\n",
       "weekday_5       7.918410e+15\n",
       "weekday_6      -3.921578e+16\n",
       "yr              1.943942e+03\n",
       "holiday        -4.713419e+16\n",
       "workingday     -4.713419e+16\n",
       "temp            3.479685e+03\n",
       "atemp           1.512918e+03\n",
       "hum            -1.945191e+03\n",
       "windspeed      -2.994006e+03\n",
       "dtype: float64"
      ]
     },
     "execution_count": 56,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#没有加正则的线性回归，所以系数很大。\n",
    "coefs"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 80,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "ridge best alpha : 0.1\n",
      "cv of rmse:  [ 804.39271834  800.17088536  800.39972672  841.34850699 1102.3410638\n",
      " 1692.53762068]\n",
      "RMSE on training set : 752.4075403032646\n",
      "RMSE on test set : 782.7437358543964\n",
      "r2_score on Training set :  0.8436144255088033\n",
      "r2_score on Test set :  0.8559447022593702\n"
     ]
    }
   ],
   "source": [
    "#RidgeCV 缺省的score是mean squred errors\n",
    "# 1.设置超参数搜索范围，生成学习器实例\n",
    "alphas = [0.01,0.1,1,10,100,1000]\n",
    "ridge = RidgeCV(alphas = alphas,store_cv_values=True)\n",
    "# 2.用训练数据度模型进行训练\n",
    "# RidgeCV采用的是广义交叉验证（generalized Cross-validation）\n",
    "ridge.fit(X_train,y_train)\n",
    "\n",
    "#通过交叉验证得到的最佳超参数alpha\n",
    "bestAlpha = ridge.alpha_\n",
    "print(\"ridge best alpha :\",bestAlpha) #best alpha : 0.1\n",
    "\n",
    "#交叉验证估计的测试误差\n",
    "mse_cv = np.mean(ridge.cv_values_,axis = 0)\n",
    "rmse_cv = np.sqrt(mse_cv)\n",
    "print(\"cv of rmse: \" ,rmse_cv)\n",
    "\n",
    "#训练上测试，训练误差，实际任务中这一步不需要\n",
    "y_train_pred = ridge.predict(X_train)\n",
    "rmse_train = np.sqrt(mean_squared_error(y_train,y_train_pred))\n",
    "\n",
    "y_test_pred = ridge.predict(X_test)\n",
    "rmse_test = np.sqrt(mean_squared_error(y_test,y_test_pred))\n",
    "print(\"RMSE on training set :\" , rmse_train)\n",
    "print(\"RMSE on test set :\", rmse_test)\n",
    "\n",
    "r2_score_train = r2_score(y_train,y_train_pred)\n",
    "r2_score_test = r2_score(y_test,y_test_pred)\n",
    "print(\"r2_score on Training set : \",r2_score_train)\n",
    "print(\"r2_score on Test set : \",r2_score_test)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[[  692173.21306765   723673.77322748   989995.90197737  1982331.20171219\n",
      "   4507632.06661551  7971039.55058459]\n",
      " [  494273.50432421   494362.27295329   569230.35056395   946574.90270662\n",
      "   3189689.71940162  8080323.38950395]\n",
      " [   57605.27663325    74232.39613711   193046.92590811   917585.18131972\n",
      "   3824762.83484604  7300041.04283842]\n",
      " ...\n",
      " [ 1416906.24718016  1393380.89112934  1311875.39595367  1359315.95457705\n",
      "   3893775.78560329 10633886.07908781]\n",
      " [  613847.07352812   652394.53602433   898470.77791164  1545279.59996999\n",
      "   3263071.77745075  7430408.08151762]\n",
      " [  220841.38285933   223382.36405716   241995.9201877    261516.95851884\n",
      "    439514.92545822   844105.17828381]]\n",
      "mse:  [ 647047.64532255  640273.44578434  640639.72253352  707867.31021486\n",
      " 1215155.82093437 2864683.59742604]\n"
     ]
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAY4AAAEKCAYAAAAFJbKyAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3XmYVPWd7/H3txeWbpCtG9npbkUMgiI2iyuOiQYzRidmEVeiKOIkczNL7sRMnhnvTG6em0wyd2ayiSi4LzFRI9eYGDSxIUaBBhEBN7rZmkWaHZqll/reP+qABVQ31XRXnVo+r+epp6t+51fnfKtp6lNnqd/P3B0REZFE5YVdgIiIZBYFh4iItIuCQ0RE2kXBISIi7aLgEBGRdlFwiIhIuyg4RESkXRQcIiLSLgoOERFpl4KwC0iGkpISLysrC7sMEZGMsnTp0u3uXnqyflkZ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5BbSKdSsEhcqwFwA3BhDilRN+UFwN/Ar4YnOs4Hbg85jnvAWcG908DGoA9Qb+rW9lOHnDkHMlNwfrb0gvYEuzx3ArkA5jZcGCbuz9IdDTYcUG7EZ17ZV0Cr1mkXXSoSuRYLxA9f/EO0b2Af3T3rWb2HPBponMbfEh0Nrk9wXN+QzRIXnX3d8zsbWAVUAu80cp2GoBzzGxpsJ4bTlLXz4HnzOzLwB+D5xNs93+aWROwHziyx3EB8FbMFMginUaj44okyMx6uPv+4ITzYuDiIFS6E30zvzg4N5LIuva7e48k1vrfwDx3fy1Z25DcpT0OkcS9FEyU0wX4rrtvBXD3g2Z2H9G5yzeEWWCMlQoNSRbtcYiISLvo5LiIiLSLgkNERNpFwSEiIu2i4BARkXZRcIiISLsoOEREpF3+P2SF5jhJYKMsAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "print(ridge.cv_values_)\n",
    "mse_mean = np.mean(ridge.cv_values_,axis = 0)\n",
    "rmse_cv = np.sqrt(mse_mean)\n",
    "print(\"mse: \" , mse_mean)\n",
    "plt.plot(np.log10(alphas),rmse_cv.reshape(len(alphas),1))\n",
    "#需要横纵坐标参数【为数组】\n",
    "plt.xlabel(\"log(alphas)\")\n",
    "plt.ylabel(\"mse\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAacAAAEICAYAAAD7pTujAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDMuMC4yLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvOIA7rQAAIABJREFUeJzt3Xu85lPd//HXOzmTCVORw2TQhGGYcbrRPZgoFIqc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PQlnXpop5ly9xKL+BKYD7wVv6efIl0r+J24PH8dfWct+bfmwbXZUfSkNXMwu/JHu1YH9Lq4g/luswGTsnpZX/egRXy+yfy/g0K5yr7O1Xry+GLzMys5XhYz8zMWo4bJzMzazlunMzMrOW4cTIzs5bjxsnMzFqOGyczM2s5bpzMzKzl/H8vJOKmB2NuXAAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<Figure size 432x288 with 1 Axes>"
      ]
     },
     "metadata": {
      "needs_background": "light"
     },
     "output_type": "display_data"
    }
   ],
   "source": [
    "#加了正则之后的 相关系数正常了。\n",
    "#coef_,不同参数的系数，多少个系数。\n",
    "ridge.coef_.shape\n",
    "\n",
    "#plot important coefficients\n",
    "ridge_coefs = pd.Series(ridge.coef_,index = feat_names)\n",
    "\n",
    "ridge_coefs\n",
    "\n",
    "#正则数值最大的10个特征和负系数值最小（）的10个特征。sort_values先排序。\n",
    "ridge_imp_coefs = pd.concat([ridge_coefs.sort_values().head(10),ridge_coefs.sort_values().tail(10)])\n",
    "ridge_imp_coefs.plot(kind = \"barh\")\n",
    "plt.title(\"Coefficients in the Ridge Model\")\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Lasso Best alpha:  1.7674411366687155\n",
      "cv of rmse:  829.7721796837446\n",
      "Lasso picked27features and eliminated the other 6 features\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "C:\\Users\\79021\\Anaconda3\\lib\\site-packages\\sklearn\\model_selection\\_split.py:2053: FutureWarning: You should specify a value for 'cv' instead of relying on the default value. The default value will change from 3 to 5 in version 0.22.\n",
      "  warnings.warn(CV_WARNING, FutureWarning)\n"
     ]
    }
   ],
   "source": [
    "#LassoCV 默认参数可自动确定alpha的搜索范围\n",
    "lasso = LassoCV()\n",
    "\n",
    "# 2.模型训练\n",
    "lasso.fit(X_train,y_train)\n",
    "alpha = lasso.alpha_\n",
    "print(\"Lasso Best alpha: \", alpha)\n",
    "\n",
    "# 3.模型性能\n",
    "mse_cv = np.mean(lasso.mse_path_,axis = 1)\n",
    "rmse_cv = np.sqrt(mse_cv)\n",
    "print(\"cv of rmse: \" ,min(rmse_cv))\n",
    "\n",
    "# 4.特征重要性\n",
    "coefs = pd.Series(lasso.coef_,index = feat_names)\n",
    "print(\"Lasso picked\" + str(sum(coefs != 0)) + \"features and eliminated the other \" + \\\n",
    "      str(sum(coefs == 0))+\" features\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.1"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
